package org.example.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("articles")
public class Article {

    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;

    private String title;
    //文章内容
    private String content;
    //文章摘要
    private String summary;

    //分类名
    @TableField(exist = false)
    private String categoryName;

    //用户昵称
    @TableField(exist = false)
    private String username;

    //所属分类id
    private Integer categoryId;
    //缩略图
    private String thumbnail;
    //状态（0已发布，1草稿）
    private Integer status;
    //访问量
    private Integer viewCount;

    private Integer likeCount;

    //评论数
    @TableField(exist = false)
    private Integer comments;

    @TableField(exist = false)
    private String avatar;

    private Integer userId;

    private Date createTime;

    private Date updateTime;
    //删除标志（0代表未删除，1代表已删除）
    private Integer delFlag;

    public Article(Integer id, Integer viewCount) {

        this.id = id;

        this.viewCount = viewCount;
    }
}
